<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ page import="com.zhangmengyuan.medical.entity.Goods" %>
<%@ page import="com.zhangmengyuan.medical.entity.User" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<!-- Template Name: Clip-One - Responsive Admin Template build with Twitter Bootstrap 3.x Version: 1.3 Author: ClipTheme -->
<!--[if IE 8]><html class="ie8 no-js" lang="en"><![endif]-->
<!--[if IE 9]><html class="ie9 no-js" lang="en"><![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<!-- start: HEAD -->
<head>
    <base href="<%=basePath%>">
    <meta charset="utf-8"/>
    <title>商品详情——医疗器械在线商城</title>

    <link rel="stylesheet" href="css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css"
          href="http://cdn.datatables.net/1.10.15/css/jquery.dataTables.css">
    <script type="text/javascript">
        function changestars(score) {

            var w = 26;
            /* one star's width */
            var totalw = w * score;
            /* score stars */
            var aa = document.getElementById("autostars");
            aa.style.width = totalw + "px";
        }

        $(function () {
            $('#wysiwyg').wysiwyg();
            aJax("MessageServlet2?reqMes=2@" +${gb.id}, "#comment");
        });

        /*********请求评论*******/
        function show() {
            var oSelect = document.getElementById("mark");
            if (oSelect.value != "") {
                document.forms['message_form'].submit();
            } else {
                alert("请选择评分");
            }

        }

        function aJax(urlStr, id) {
            $.ajax
            ({
                type: "POST",
                contentType: "application/x-www-form-urlencoded",
                dataType: "HTML",
                url: urlStr,
                success: function (data) {
                    $(id)[0].innerHTML = data;
                },
                timeout: 30000,
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert(errorThrown);
                }
            });
        }

    </script>
    <style>
        #talkdiv {
            width: 200px;
            height: 300px;
            right: 10px;
            bottom: 50px;
            display: none;
            background-color: #CCCC33;
            position: absolute;
        }

        #offbutton {
            width: 15px;
            height: 15px;
            float: right;
        }

        #comment {
            width: 750px;
            height: 320px;
            border: 1px solid #ebe5e9;
            overflow: scroll;
            color: #333;
        }

        .fivestars, .fivestars div {
            background: transparent url(images/commstar.gif) repeat-x scroll left bottom;
            width: 130px;
        }

        .fivestars {
            padding: 0;
            position: relative;
            line-height: 28px;
            display: inline-block;
        }

        .fivestars div {
            background-position: bottom center;
            text-indent: -9999px;
        }

        .fivestars div {
            background-position: left top;
            width: 0px;
        }
    </style>
</head>

<body>
<div id="header">

    <div class="top">
        <c:choose>
            <c:when test="${!empty sessionScope.user }">
                <span>欢迎您：${sessionScope.user.userName}</span>
            </c:when>
        </c:choose>
        <div id="talkdiv" align="center">
            <span>欢迎您：：${sessionScope.user.userName}</span> <img
                src="images/offbutton.jpg" id="offbutton"/>
            <div id="msgDiv" align="center">
                <textarea id="allmsg" name="allmsg" rows="8"></textarea>
            </div>
            <div id="sendDiv" align="center" style="padding-top: 20px;">
                <textarea id="sendmsg" name="sendmsg" rows="4"></textarea>
                <input type="button" id="send" name="send" onClick="reqPost();" value="发送"/>
                <input type="button" onClick="clearmsg();" value="清屏">
                <input type="button" id="exit" onclick="exitGet();" value="退出">
            </div>
        </div>

        <a href="register.jsp">注册</a>] [<a href="login.jsp">登录</a>] [<a
            href="cart.jsp">我的购物车</a>]
        <c:choose>
            <c:when test="${empty sessionScope.user }">
                <div id="talkdivff" align="center">
                    <h3>
                        您还没有登录呢...点击此处去<a href="login.jsp">登录</a>...
                    </h3>
                </div>
            </c:when></c:choose>

    </div>
</div>


<div class="cart">
    您的<a href="cart.jsp">购物车</a>&nbsp;&nbsp;目前有<strong>
</strong>件商品
</div>
<div id="nav">
    <ul>
        <li><a href="index.jsp">首页</a></li>
        <li><a href="index.jsp">家用器械</a></li>
        <li><a href="index.jsp">医用器械</a></li>
        <li><a href="index.jsp">保健养生</a></li>
        <li><a href="index.jsp">健康中心</a></li>
        <li><a href="index.jsp">服务中心</a></li>

    </ul>
</div>


<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>

<c:forEach items="${list}" var="g">
    ${g.goodsName},
    ${g.price},
    ${g.num},
    ${g.goodsType_name},
    ${g.smallType_name},
    ${g.direction},
    ${g.cart_num},
    ${g.picPath},
</c:forEach>
<div id="pro_detail">
    <div id="pro_img">
        <div id=preview>
            <div class="jqzoom" id="spec-n1">
                <img src='img/' jqimg="images/pro_001.jpg"
                     style="width: 220px; height: 250px;">
            </div>
        </div>
    </div>

    <div id="pro_content">
        <div class="pro_title">
            <h2>${ goods.goodName}</h2>
            <span style="color: #666666;">最近30天已售出：件</span>
        </div>
        <div class="pro_info">
            <h3>
                库存量: <b>${goods.num}</b>
            </h3>
            <h3>
                品牌:<b>goods.getGoodsName()</b>
            </h3>
            <h3>
                分类:<b>goods.getGoodsType_name()</b>
            </h3>
            <div class="pro_info_price">
                <h3>价格:</h3>
                <b class="pro_price">goods.getPrice().00</b>
            </div>
            联系客服：<img id="kefu" title="联系客服" alt="联系客服" src="images/chat.jpg"
                      width="30px;" height="30px;" style="cursor: hand">
            </h3>
            <img title="加入购物车" src="images/addcart.png" width="100px;" height="30px;" style="cursor: hand"
                 onclick="addTOCart('')">
            <img title="立即购买" src="images/gotobuy.png" width="100px;" height="30px;" style="cursor: hand;"
                 onClick="goToBuy();">
        </div>
    </div>
    <div id="watch_detail" class="sort_list">
        <h1>看了该商品的顾客还看过</h1>
        <ul id="rmp_ul">
        </ul>
    </div>
</div>
<div id="main_detail">
    <div id="sort22">
        <ul class="tabMenu">
            <li id="show1" name="xsjl">销售记录</li>
            <li id="show2" name="spxq">商品详情</li>
            <li id="show3" name="yhpj">用户评价</li>
        </ul>

        <div id="showspxq" style="display: none;margin-top: 20px;" class="sort_list">
            <center>
                <span>暂无销售记录</span>
            </center>
        </div>
        <div id="showyhpj" class="sort_list" style="margin-top: 20px; ">
            <center>
                <h3>
                    品牌:<b>goods.getGoodsName()</b>
                </h3>
                <h3>
                    分类:<b>goods.getGoodsType_name()</b>
                </h3>
                <h3>价格:</h3>
                <b class="pro_price">goods.getPrice().00</b>
            </center>
        </div>
        <div id="showxsjl" style="display: none" class="sort_list">

            <ul>
                <h1>用户评论展示</h1>
                <div id="comment"></div>
            </ul>
            <ul id="editor">
                <h1>编辑框</h1>
                <form id="message_form" method="post"
                      action="MessageServlet2?reqMes=1@goods.getGoodsId()">
                    <table>
                        <tr>
                            <td><textarea name="wysiwyg" id="wysiwyg" rows="3"
                                          cols="64"></textarea></td>
                            <td>
                                <div>
                                    <select id="mark" name="mark"
                                            onchange="changestars(this.value)">
                                        <option value="" selected="selected">--请选择--</option>
                                        <option value="0">0分</option>
                                        <option value="0.5">0.5分</option>
                                        <option value="1">1分</option>
                                        <option value="1.5">1.5分</option>
                                        <option value="2">2分</option>
                                        <option value="2.5">2.5分</option>
                                        <option value="3">3分</option>
                                        <option value="3.5">3.5分</option>
                                        <option value="4">4分</option>
                                        <option value="4.5">4.5分</option>
                                        <option value="5">5分</option>
                                    </select><br>
                                    <div class="fivestars" id="fivestars">
                                        <div class="autostars" id="autostars">&nbsp;</div>
                                    </div>
                                    <br> <img src="images/submit.jpg"
                                              style="width: 80px; heigth: 16px; cursor: hand;"
                                              onClick="show()"/>
                                    <!-- onclick="javascript:document.forms['message_form'].submit();" -->
                                </div>
                            </td>
                        </tr>
                    </table>
                </form>
            </ul>

        </div>
    </div>
</div>
<div class="w990" style="margin-top: 30px">
    <div class="footer-link">
        <a href="http://www.yiliu88.com/helpcenter/zizhi.aspx#jyfw">互联网药品交易服务资格证</a>
        <a href="http://www.yiliu88.com/helpcenter/zizhi.aspx#xxfw">互联网药品信息服务资格证</a>
        <a href="http://www.yiliu88.com/helpcenter/zizhi.aspx#jyxk">医疗器械经营许可证</a>
        <a href="http://www.yiliu88.com/helpcenter/zizhi.aspx#zzdx">增值电信业务经营许可证</a>
        <hr style="color: #cccccc" size="1px"/>
    </div>
    <div class="call">
        客户服务热线：400-111-0000
    </div>
    <div class="copyright"></div>
    <span>
        Copyright&copy;&nbsp;2018&nbsp;&nbsp;医疗器械<a href='index.jsp'>www.ylqx.com</a>商城保留一切权利。
        &nbsp;All Rights Reserved.&nbsp;&nbsp;<br/>
        &nbsp;&nbsp;
        地址：河南省平顶山市平顶山学院&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </span>
</div>

</body>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>

</html>